// 创建一个路由器并暴露出去

// 引入createRouter
import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'


// 引入可能需要呈现的组件
import Swiper from "@/components/Mmp/Swiper.vue"
import IndexNotice from '@/components/Mmp/IndexNotice.vue'
import ApplyInfo from '@/components/club/ApplyInfo.vue'
import MemberInfo from '@/components/club/MemberInfo.vue'
import ActiveInfo from '@/components/club/ActiveInfo.vue'
import Login from "@/views/pages/Login.vue"
import Home from '@/views/pages/Home.vue'
import Index from '@/components/Index.vue'
import MilitaryTraining from "@/components/Mmp/MilitaryTraining.vue"

import PreMemberInfo from '@/components/pre-reserve/PreMemberInfo.vue'
import PersonalInfo from '@/components/pre-reserve/PersonalInfo.vue'
import DataScreen from '@/views/pages/DataScreen.vue'
import JoinArmyMember from '@/components/join-army/JoinArmyMember.vue'
import JoinArmyMemberInfo from '@/components/join-army/JoinArmyMemberInfo.vue'

import CenterMap from '@/components/data-screen/CenterMap.vue'
import LeftTopChartMain from '@/components/data-screen/left-top/LeftTopChartMain.vue'
import LeftCenterChartMain from '@/components/data-screen/left-center/LeftCenterChartMain.vue'
import LeftBottomChartMain from '@/components/data-screen/left-bottom/LeftBottomChartMain.vue'
// 数据大屏相关组件
import RightTopChartMain from '@/components/data-screen/right-top/RightTopChartMain.vue'
import RightCenterChartMain from '@/components/data-screen/right-center/RightCenterChartMain.vue'
import RightBottomChartMain from '@/components/data-screen/right-bottom/RightBottomChartMain.vue'

import Message from '@/components/Mmp/message/Message.vue'
import Chat from '@/components/Mmp/message/Chat.vue'
import Report from '@/components/PhysicalFitnessReport.vue'
import Recommend from '@/components/RecommendTroops.vue'
import Profile from '@/views/pages/Profile.vue'

import VeteranMemberInfo from '@/views/pages/VeteranMemberInfo.vue'

//全校学生数据
import SMemberInfo from '@/components/school/MemberInfo.vue'
import SMemberDetilInfo from '@/components/school/MemberDetailInfo.vue'

import ClubPersonInfo from '@/components/club/ClubPersonInfo.vue'

// 创建路由器
const router = createRouter({
  // history: createWebHistory(),
  history: createWebHashHistory(),
  routes: [
    {
      path: "/login",
      name: "Login", // 添加路由名称
      component: Login
    },
    {
      path: "/report",
      component: Report
    },
    {
      path: "/recommend",
      component: Recommend
    },

    //数据大屏
    {
      path: "/dataScreen",
      name: "DataScreen",
      component: DataScreen,
      children: [
        //默认展示中心地图
        {
          path: "",
          name: "centerMap",
          component: CenterMap,
        },
        {
          path: "/dataScreen",
          component: CenterMap,
        },
        //左上图
        {
          path: "/dataScreen/leftTopChartMain",
          component: LeftTopChartMain,
        },
        //左中
        {
          path: "/dataScreen/leftCenterChartMain",
          component: LeftCenterChartMain,
        },
        //左下图
        {
          path: "/dataScreen/leftBottomChartMain",
          component: LeftBottomChartMain
        },
        {
          path: "/dataScreen/leftCenterChartMain",
          component: LeftCenterChartMain,
        },
        // 右上图表
        {
          path: "/dataScreen/rightTop-chartMain",
          component: RightTopChartMain,
        },
        // 右中图表
        {
          path: "/dataScreen/rightCenterChartMain",
          component: RightCenterChartMain,
        },
        // 右下图表
        {
          path: "/dataScreen/rightBottom-chartMain",
          component: RightBottomChartMain,
        }
      ]
    },
    // Home 作为布局容器
    {
      path: "/",
      component: Home, // 固定布局组件
      children: [
        // 默认重定向到首页
        {
          path: "",
          redirect: "/index",
        },
        // 首页
        {
          path: "/index",
          component: Index,
          meta: {
            title: "首页"
          }
        },
        {
          path: "/profile",
          component: Profile
        },
        // 征兵处老师的路由
        {
          path: "/Mmp/swiper",
          component: Swiper,
          meta: {
            title: "小程序管理 / 轮播图管理",
            roles: ["admin"]
          }
        },
        {
          path: "/Mmp/notice",
          component: IndexNotice,
          meta: {
            title: "小程序管理 / 通知管理",
            roles: ["admin"]
          }
        },
        {
          path: "/Mmp/message",
          component: Message,
          meta: {
            title: "小程序管理 / 在线咨询",
            roles: ["admin"]
          },
          children: [
            {
              path: "/Mmp/message/chat/:receiverId",
              component: Chat,
              props: true //是否需要传递参数
            }
          ]
        },
        {
          path: "/Mmp/train-show",
          component: MilitaryTraining,
          meta: {
            title: "小程序管理 / 军训展示管理",
            roles: ["admin"]
          }
        },
        // 公共路由
        {
          path: "/admin/school/memberManage",
          component: SMemberInfo,
          meta: {
            title: "全校数据 / 人员管理",
            roles: ["admin", "college_admin"]
          }
        },
        {
          path: "/admin/school/memberDetilInfo",
          component: SMemberDetilInfo,
          meta: {
            title: "全校数据 / 人员档案",
            roles: ["admin", "college_admin"]
          }
        },
        {
          path: "/admin/memberManage",
          component: MemberInfo,
          meta: {
            title: "社团管理 / 人员管理",
            roles: ["admin", "college_admin"]
          }
        },
        {
          path: "/admin/activeManage",
          component: ActiveInfo,
          meta: {
            title: "社团管理 / 现役人员管理",
            roles: ["admin", "college_admin"]
          }
        },
        {
          path: "/admin/applyManage",
          component: ApplyInfo,
          meta: {
            title: "社团管理 / 报名信息审核",
            roles: ["admin", "college_admin"]
          }
        },
        {
          path: "/admin/club/clubPersonInfo",
          component: ClubPersonInfo,
          meta: {
            title: "社团管理 / 个人信息",
            roles: ["admin", "college_admin"]
          }
        },
        {
          path: "/admin/preReserve/memberManage",
          component: PreMemberInfo,
          meta: {
            title: "预储管理 / 人员管理",
            roles: ["admin", "college_admin"]
          }
        },
        {
          path: "/admin/preReserve/personalInfo",
          component: PersonalInfo,
          meta: {
            title: "预储管理 / 个人信息",
            roles: ["admin", "college_admin"]
          }
        },
        {
          path: "/admin/JoinArmy/joinArmyMember",
          component: JoinArmyMember,
          meta: {
            title: "入伍管理 / 个人信息",
            roles: ["admin", "college_admin"]
          }
        },
        {
          path: "/admin/JoinArmy/joinArmyMemberInfo",
          component: JoinArmyMemberInfo,
          meta: {
            title: "入伍管理 / 个人信息",
            roles: ["admin", "college_admin"]
          },
        },
        {
          path: "/admin/veteran/veteranMemberInfo",
          component: VeteranMemberInfo,
          meta: {
            title: "退役管理 / 退役人员信息管理",
            roles: ["admin", "college_admin"]
          },
        }
      ]
    },

  ]
})

export default router